﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OrderManagement
{
    class Order
    {
        public Customers customer { get; set; }
        public OrderDetails OrderDetails { get; set; }
        public String ID { get; set; }
        public Order(Customers customer,OrderDetails OrderDetails,String ID)
        {
            this.customer = customer;
            this.OrderDetails = OrderDetails;
            this.ID = ID;
        }
        public override string ToString()
        {
            String str = customer.ToString() + OrderDetails.ToString()+"订单号为："+ID+"总金额为"+OrderDetails.Price;
            return str;
        }
        public override bool Equals(object obj)
        {
            Order a = obj as Order;
            return a.ID == this.ID;
        }

        public override int GetHashCode()
        {
            int hashCode = 1795549856;
            hashCode = hashCode * -1521134295 + EqualityComparer<Customers>.Default.GetHashCode(customer);
            hashCode = hashCode * -1521134295 + EqualityComparer<OrderDetails>.Default.GetHashCode(OrderDetails);
            hashCode = hashCode * -1521134295 + EqualityComparer<String>.Default.GetHashCode(ID);
            return hashCode;
        }
        
    }
}
